import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:psi/widgets/text_widget.dart';

import '../generated/assets.dart';

class EmptyWidget extends StatelessWidget {
  final String emptyText;
  final String emptyImgName;
  final double imgWidth, imgHeight, textPadding;
  final Color emptyTextColor;
  final double emptyTextSize;
  final double topPadding, bottomPadding;
  final Color bgColor;
  final VoidCallback? onTap;

  EmptyWidget(
    this.emptyText, {
    this.emptyImgName = R.iconEmpty,
    this.imgWidth = 140,
    this.imgHeight = 78,
    this.textPadding = 27,
    this.emptyTextColor = const Color(0xFF333333),
    this.emptyTextSize = 16,
    this.topPadding = 60,
    this.bottomPadding = 0,
    this.bgColor = Colors.transparent,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: EdgeInsets.only(top: topPadding, bottom: bottomPadding),
        alignment: Alignment.topCenter,
        color: bgColor,
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Image.asset(emptyImgName, width: imgWidth, height: imgWidth),
            SizedBox(height: textPadding),
            TextWidget(
              emptyText,
              fontSize: emptyTextSize,
              color: emptyTextColor,
            ),
          ],
        ),
      ),
    );
  }
}
